define(function(require,exports,modlue){
	
	//获取当前类别
	var arcType = $(".arcList").attr("data-val");
	var tabitems = $(".qd_mediacenter").find(".qd_tab_item");
	tabitems.removeClass("qd_selected");
    if(arcType=="borrowNotice"){
        $(tabitems[0]).addClass("qd_new_select");
        $(".qdc_tab_item_container h3 font").text($(tabitems[0]).text());
    }else if(arcType=="repayNotice"){
		$(tabitems[1]).addClass("qd_new_select");
		$(".qdc_tab_item_container h3 font").text($(tabitems[1]).text());
	}else if(arcType=="notice"){
		$(tabitems[2]).addClass("qd_new_select");
		$(".qdc_tab_item_container h3 font").text($(tabitems[2]).text());
	}else if(arcType=="cartoon"){
		$(tabitems[3]).addClass("qd_new_select");
		$(".qdc_tab_item_container h3 font").text($(tabitems[3]).text());
	}else if(arcType=="hyNews"){
	}else{
		$(tabitems[4]).addClass("qd_new_select");
		$(".qdc_tab_item_container h3 font").text($(tabitems[4]).text());
	}
	
	
	//文章列表
	$.ajax({
		url:"/article/list.html?nid=" + arcType + "&randomTime=" + (new Date()).getTime(),
		type:"get",
		dataType:"json",
		success:function(data){
			var tpl = require('/themes/theme_default/media/tpl/arcList.tpl');//载入tpl模板
			var template = Handlebars.compile(tpl);
			var html = template(data);
			$(".arcList").html(html);
			//分页插件
			if(data.data.page.pages > 0)
			{
				require.async(['/plugins/pager/pager.css','/plugins/pager/pager'],function(){
					kkpager.generPageHtml({
						pno : data.data.page.currentPage,//当前页码
						total : data.data.page.pages,//总页码
						totalRecords : data.data.page.total,//总数据条数
						isShowFirstPageBtn	: false, 
						isShowLastPageBtn	: false, 
						isShowTotalPage 	: false, 
						isShowTotalRecords 	: false, 
						isGoPage 			: false,
						lang:{
							prePageText				: '<',
							nextPageText			: '>'
						},
						mode:'click',//click模式匹配getHref 和 click
						click:function(n,total,totalRecords){
				        	$.ajax({
				        		type:"get",
				        		url:"/article/list.html?nid="+arcType+"&page="+n,
				        		dataType:"json",//这个必不可少，如果缺少，导致传回来的不是json格式
				        		success:function(json){
									var tpl = require('/themes/theme_default/media/tpl/arcList.tpl');
									var template = Handlebars.compile(tpl);
									var html    = template(json);
									$(".arcList").html(html);
				        		}
				        	});
							this.selectPage(n); //处理完后可以手动条用selectPage进行页码选中切换
						}
					});
				});
			}else{
				$("#kkpager").html('暂无数据');
			}
		}
		
	});
	
	

});
